package com.smartmedical.doctor.friend.controller;

import com.smartmedical.common.core.domain.HealthR;
import com.smartmedical.doctor.friend.domain.vo.PatientCircleVo;
import com.smartmedical.doctor.friend.domain.vo.SickCircleByKeyWordVo;
import com.smartmedical.doctor.friend.domain.vo.SickCircleVo;
import com.smartmedical.doctor.friend.service.PatientCircleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.github.pagehelper.page.PageMethod.startPage;

/**
 * @Author：闫晓琪
 * @Filename：PatientCircleController
 * @Package：com.smartmedical.dcotor.firend.controller
 * @Project：smart-medical
 * @name：PatientCircleController
 * @Date：2024/1/12 21:34
 */

@RequestMapping("/sickCircle")
@RestController
public class PatientCircleController {

    @Autowired
    private PatientCircleService patientCircleService;

    /**
     * 病友圈列表
     * @param departmentId
     * @param page
     * @param count
     * @return
     */
    @GetMapping("/v1/findSickCircleList")
    public HealthR<List<PatientCircleVo>> findSickCircleList(@RequestParam Integer departmentId,
                                                             @RequestParam(name = "page",defaultValue="1") int page,
                                                             @RequestParam(name = "count") int count){
        startPage(page,count);
        HealthR<List<PatientCircleVo>> patientCircleServiceSickCircleList = patientCircleService.findSickCircleList(departmentId);
        return patientCircleServiceSickCircleList;
    }

    /**
     * 查询病友圈详情
     * @param sickCircleId
     * @return
     */
    @GetMapping("v1/findSickCircleInfo")
    public HealthR<SickCircleVo> findSickCircleInfo(@RequestParam Integer sickCircleId){
        return patientCircleService.findSickCircleInfo(sickCircleId);
    }


    @GetMapping("v1/searchSickCircle")
    public HealthR<List<SickCircleByKeyWordVo>> searchSickCircleSearch(@RequestParam String keyWord) {

        return patientCircleService.searchSickCircle(keyWord);
    }


    @PostMapping("verify/v1/publishComment")
    public HealthR publishComment(@RequestParam Integer sickCircleId, @RequestParam String content) {

        return patientCircleService.publishComment(sickCircleId,content);
    }



}
